package org.truenewx.tnxjee.core.enums;

import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

public abstract class EnumDict {

    private Locale locale;
    private Set<String> initializedKeys = new HashSet<>();

    public EnumDict(Locale locale) {
        if (locale == null) {
            this.locale = Locale.getDefault();
        } else {
            this.locale = locale;
        }
    }

    public final Locale getLocale() {
        return this.locale;
    }

    public final boolean isInitialized(String key) {
        return this.initializedKeys.contains(key);
    }

    public final void setInitialized(String key) {
        this.initializedKeys.add(key);
    }

    public void removeInitialized(String key) {
        this.initializedKeys.remove(key);
    }

    public abstract void addType(EnumType type);

    public EnumType getType(String name) {
        return getType(name, null);
    }

    public abstract EnumType getType(String name, String subname);

    public abstract boolean containsType(String name, String subname);

    public abstract int getTypeTotal();

    public abstract List<EnumType> getSubTypes(String name);

}
